<template>
  <one-mask :showMask.sync="visable" class="koi-loading" :class="customClass" :mask-hide="false">
    <div class="koi-loading-box">
      <div class="koi-loading-icon"></div>
      <div class="koi-loading-text" v-show="text"><span>{{ text }}</span></div>
    </div>
  </one-mask>
</template>

<style lang="less">
.koi-loading {
  z-index: 11000;
  &-box {
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 6px;
    text-align: center;
  }

  &-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto;
    border-radius: 50%;
    -webkit-animation: loading-rotate 1s infinite linear;
    animation: loading-rotate 1s infinite linear;
    box-sizing: border-box;

    border: 3px solid transparent;
    border-bottom-color: rgb(204, 204, 204);
    border-top-color: rgb(204, 204, 204);
    border-right-color: rgb(204, 204, 204);
  }

  @-webkit-keyframes loading-rotate {
    0% {
      -webkit-transform: rotate(0deg);
      transform: rotate(0deg);
    }
    100% {
      -webkit-transform: rotate(360deg);
      transform: rotate(360deg);
    }
  }

  @keyframes loading-rotate {
    0% {
      -webkit-transform: rotate(0deg);
      transform: rotate(0deg);
    }
    100% {
      -webkit-transform: rotate(360deg);
      transform: rotate(360deg);
    }
  }

  &-text {
    color: #fff;
    font-size: 14px;
    display: inline-block;
    margin-top: 10px;
  }
}
</style>

<script>
export default {
  name: 'koi-loading',
  props: {
    text: {
      //输入本文,如加载中
      type: String,
      default: ''
    },
    // 是否显示
    visable: {
      type: Boolean,
      default: false
    },
    customClass: {
      type: String,
      default: ''
    }
  },
  methods: {}
}
</script>
